//class 类 demo
class Girl{
   name; //声明属性
   age;
   sex;
   //构造方法 只能有一个构造方法
   constructor(name,age,sex){
       this.name = name;
       this.age = age;
       this.sex = sex;
   }

}
let girl = new Girl("花姑娘",18,"非常性感");
console.log(girl);
let girlone = new Girl("花仙子");
girlone.age = 18;
console.log(girlone)
console.log(girlone.name)

//不需要声明属性也可以，这他妈也行。
class Boy{
    constructor(name){
        this.name = name;
    }
    //方法 这他妈写起来终于有java的感觉了
    sum(a,b){
        console.log('a:'+a+',b:'+b)
        return a+b;
    }
}
let boy = new Boy("黄三")
console.log(boy)
console.log(boy.name)
//自定义添加属性
boy.age = 20;
console.log(boy)

console.log(boy.sum(1,2))


class Daughter{
    name;
    age;
    sex;
    constructor(name,age,sex){
        this.name = name;
        this.age = age;
        this.sex = sex;
    }
    //get方法
    get getName(){
        return this.name;
    }
    //set 方法
    set setName(name){
        this.name = name;
    }
    ripi(){
        console.log('大哥要日批');
    }
    
}
let dauthter = new Daughter('小光',16,'女');
console.log(dauthter)
console.log(dauthter.getName)
dauthter.setName='小狗'
console.log(dauthter)
console.log(dauthter.getName)

//类继承 
class Sister extends Daughter{
    jiji; //增加属性
    sanwei;
    constructor(name,age,sex,jiji,sanwei){
        super(name,age,sex);
        this.jiji = jiji;
        this.sanwei =sanwei;
    }


}
const sister = new Sister('飞机','大哥','日婆娘','28cm',"黄金比例");
sister.setName='狗';
console.log(sister)
sister.ripi()




//输出 
module.exports = sister;
